<?php
/**
 * Contextual Help
 *
 * @package     EDD
 * @subpackage  Admin/Settings
 * @copyright   Copyright (c) 2013, Pippin Williamson
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.4
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Settings contextual help.
 *
 * @access      private
 * @since       1.4
 * @return      void
 */
function edd_settings_contextual_help() {
	$screen = get_current_screen();

	if ( $screen->id != 'download_page_edd-settings' )
		return;

	$screen->set_help_sidebar(
		'<p><strong>' . sprintf( __( 'For more information:', 'edd' ) . '</strong></p>' .
		'<p>' . sprintf( __( 'Visit the <a href="%s">documentation</a> on the Easy Digital Downloads website.', 'edd' ), esc_url( 'https://easydigitaldownloads.com/documentation/' ) ) ) . '</p>' .
		'<p>' . sprintf(
					__( '<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>. View <a href="%s">extensions</a> or <a href="%s">themes</a>.', 'edd' ),
					esc_url( 'https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues' ),
					esc_url( 'https://github.com/easydigitaldownloads/Easy-Digital-Downloads' ),
					esc_url( 'https://easydigitaldownloads.com/extensions/' ),
					esc_url( 'https://easydigitaldownloads.com/themes/' )
				) . '</p>'
	);

	$screen->add_help_tab( array(
		'id'	    => 'edd-settings-general',
		'title'	    => __( 'General', 'edd' ),
		'content'	=> '<p>' . __( 'This screen provides the most basic settings for configuring your store. You can set the currency, page templates, and turn <em>Test Mode</em> on and off.', 'edd' ) . '</p>'
	) );

	$screen->add_help_tab( array(
		'id'	    => 'edd-settings-payment-gateways',
		'title'	    => __( 'Payment Gateways', 'edd' ),
		'content'	=>
			'<p>' . __( 'This screen provides ways to toggle payment gateways on or off, as well as configure gateway-specific settings. Any extra payment gateway extensions you have installed will appear on this page, and can be configured to suit your needs.', 'edd' ) . '</p>' . 
			'<p>' . __( '<strong>Test Payment</strong> - This included gateway is great for testing your store, as it requires no payment, and leads straight to product downloads. However, please remember to turn it off once your site is live!', 'edd' ) . '</p>' .
			'<p>' . __( '<strong>PayPal</strong> - A PayPal payment gateway is included as standard with Easy Digital Downloads. To test the PayPal gateway, you need a Sandbox account for PayPal and the site must be placed in Test Mode from the General settings tab. Please remember to enter your PayPal account email address in order for payments to get processed.', 'edd' ) . '</p>'
	) );

	$screen->add_help_tab( array(
		'id'	    => 'edd-settings-emails',
		'title'	    => __( 'Emails', 'edd' ),
		'content'	=>
			'<p>' . __( "This screen allows you to customize how emails act throughout your store. You can choose a premade template, set the sender's name, email address, and subject.", 'edd' ) . '</p>' .
			'<p>' . __( 'A set of email tags has also been provided to allow the creation of personalized emails. A tag consists of a keyword surrounded by curly braces: <code>{tag}</code>. A description of each of these tags appear below the editor.', 'edd' ) . '</p>'
	) );

	$screen->add_help_tab( array(
		'id'	    => 'edd-settings-styles',
		'title'	    => __( 'Styles', 'edd' ),
		'content'	=> '<p>' . __( "This screen allows customization of your store's styles. For complete control, you can completely disable all styles generated by the plugin.", 'edd' ) . '</p>' 
	) );

	$screen->add_help_tab( array(
		'id'	    => 'edd-settings-taxes',
		'title'	    => __( 'Taxes', 'edd' ),
		'content'	=> '<p>' . __( 'This screen provides basic settings for adjusting how tax rules work for purchases.', 'edd' ) . '</p>' 
	) );

	$screen->add_help_tab( array(
		'id'		=> 'edd-settings-extensions',
		'title'		=> __( 'Extensions', 'edd' ),
		'content'	=> '<p>' . __( 'This screen provides access to settings added by most Easy Digital Downloads extensions.', 'edd' ) . '</p>'
	) );

	$screen->add_help_tab( array(
		'id'	    => 'edd-settings-misc',
		'title'	    => __( 'Miscellaneous', 'edd' ),
		'content'	=>
			'<p>' . __( 'This screen provides other miscellaneous options such as disabling jQuery, allowing guest checkout, and configuring your terms of service.', 'edd' ) . '</p>' .
			'<p>' . __( 'A description of all the options are provided beside their input boxes.', 'edd' ) . '</p>'
	) );

	do_action( 'edd_settings_contextual_help', $screen );
}
add_action( 'load-download_page_edd-settings', 'edd_settings_contextual_help' );
